package org.leo.dm.example.plugin;

import java.util.UUID;

import org.leo.dm.component.plugin.columnplugin.ColumnPlugin;

public class PluginColumnCustom2 extends ColumnPlugin {

	int numID = 1;
	int numID1 = 1;
	int numID2 = 1;
	int numID3 = 1;
	int numPID = 1;
	int numbusinessid = 1;

	int acsc = 1;

	@Override
	public String handle(String segmentName, String columnName, String columnValue) throws Exception {

		if ("WS02_01_039_001".equals(columnName)) {
			columnValue = String.valueOf(numID++);
		}
		
		if ("WS02_01_040_01".equals(columnName)) {
			columnValue = String.valueOf(numID1++);
		}
		
		if ("CT02_01_040_01".equals(columnName)) {
			columnValue = String.valueOf(numID2++);
		}
		
		if ("WS01_00_009_01".equals(columnName)) {
			columnValue = String.valueOf(numID++);
		}
		
		if ("WS01_00_008_01".equals(columnName)) {
			columnValue = String.valueOf(numID1++);
		}
		
		if ("WS01_00_912_01".equals(columnName)) {
			columnValue = String.valueOf(numID2++);
		}
		
		if ("WS01_00_912_02".equals(columnName)) {
			columnValue = String.valueOf(numID3++);
		}
		
		if ("WS06_00_943_01".equals(columnName)) {
			columnValue = String.valueOf(numID2++);
		}
		
		if ("WS08_10_052_17".equals(columnName)) {
			columnValue = String.valueOf(numID3++);
		}
		
		if ("PID".equals(columnName)) {
			columnValue = String.valueOf((numPID++) % 3 + (acsc++));
		}
		if ("BUSINESS_ID".equals(columnName)) {
			columnValue = String.valueOf((numbusinessid++) % 3 + (acsc++));
		}
		if ("BATCH_NUM".equals(columnName)) {
			columnValue = String.valueOf(12345);
		}
		if ("SERIALNUM_ID".equals(columnName)) {
			columnValue = UUID.randomUUID().toString();
		}
		return columnValue;
	}

}
